<template>
	<view>
		<view class="comment-list">
			<view class="item-comment" v-for="(item,index) in list" :key="index">
				<image class="comment-header" :src="item.avatar"></image>
				<view class="right-info">
					<view class="user-name">
						{{item.nickname}}
					</view>
					<view class="start-time">
						<uni-rate readonly activeColor="#EF5233" :max="5" size="14" :value="item.star" />
						<view class="time">
							{{item.create_time}}
						</view>
					</view>
				</view>
			</view>
			<blankPage img="https://qiniu-cdn.maeiyun.com/imgs/blank/no_order.png" text="暂无记录" :width="161" :height="129" v-show="list.length == 0"></blankPage>
		</view>
	</view>
</template>

<script>
	export default {
		name:'commentList',
		data() {
			return {
				list:[],
				page:1,
				total:0,
				id:""
			}
		},
		onPullDownRefresh() {
			this.page = 1
			this.list = []
			this.getList()
			uni.startPullDownRefresh();
		},
		methods: {
			getList(){
				this.request.httpTokenRequest({
					url: "order/getContentList",
					method: "get"
				}, {
					service_id:this.id,
					page:this.page
				}).then(data => {
					if (data.code == 0) {
						this.total = data.data.total
						data.data.data.forEach(item=>{
							this.list.push(item)
						})
						uni.stopPullDownRefresh();
					}else {
						this.$util.msg(data.msg)
					}
				}, error => {})
			}
		},
		onLoad(option) {
			this.id = option.id
			this.getList()
		},
		onReachBottom() {
			if(this.total > this.list.length){
				this.page ++ 
				this.getList()
			}
		}
	}
</script>

<style lang="scss">
	.comment-list{
		padding: 0 30rpx;
	}
	.item-comment{
		display: flex;
		align-items: flex-start;
		padding: 24rpx 0 ;
		border-bottom: 2rpx solid #E3E2E2;
		.comment-header{
			width: 81rpx;
			height: 81rpx;
			border-radius: 50%;
			flex: 0 0 auto;
		}
		.right-info{
			margin-left: 27rpx;
			flex: 1 0 auto;
			.start-time{
				display: flex;
				align-items: center;
				margin-top: 10rpx;
				image{
					width: 18rpx;
					height: 18rpx;
				}
				.time{
					margin-left: 12rpx;
					font-size: 20rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					color: #858688;
				}
			}
			.subscribe-info{
				display: flex;
				align-items: center;
				width: fit-content;
				height: 38rpx;
				background: #E6E9EA;
				border-radius: 19rpx;
				line-height: 38rpx;
				margin-top: 10rpx;
				font-size: 24rpx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				color: #090B0B;
				padding: 0 10rpx 0 0;
				.technician-header{
					width: 34rpx;
					height: 34rpx;
					border-radius: 50%;
				}
				.technician-name{
					font-size: 24rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					color: #090B0B;
				}
				.lines{
					width: 1rpx;
					height: 24rpx;
					background-color: #BEBEBE;
					margin:  0 10rpx;
				}
				.yue-btn{
					width: 80rpx;
					height: 30rpx;
					background: #E7533F;
					border-radius: 19rpx;
					font-size: 20rpx;
					font-family: PingFangSC, PingFang SC;
					font-weight: 400;
					color: #FFFFFF;
					line-height: 30rpx;
					text-align: center;
					margin-left: 6rpx;
				}
			}
			.address-zan{
				display: flex;
				align-items: center;
				justify-content: space-between;
				font-size: 20rpx;
				font-family: PingFangSC, PingFang SC;
				font-weight: 400;
				color: #858688;
				margin-top: 20rpx;
				.zan{
					display: flex;
					align-items: center;
					image{
						width: 25rpx;
						height: 24rpx;
						margin-right: 12rpx;
					}
				}
				
			}
		}
	}

</style>
